//
//  QRCodeScanOverlayer.m
//  Staff
//
//  Created by caiyao on 12/3/14.
//
//

#import "QRCodeScanOverlayer.h"

@implementation QRCodeScanOverlayer

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self = [[NSBundle mainBundle] loadNibNamed:@"QRCodeScanOverlayer" owner:self options:nil].lastObject;
    }
    return self;
}

- (void)awakeFromNib {
    
    CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI/2);
    CGAffineTransform transform2 = CGAffineTransformMakeRotation(M_PI);
    CGAffineTransform transform3 = CGAffineTransformMakeRotation(-M_PI/2);
    topRight.transform = transform;
    bottemRight.transform = transform2;
    bottemLeft.transform = transform3;
    [self sendSubviewToBack:bottomView];
    navBar.backgroundColor = [UIColor darkGrayColor];
    scanView.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width-scanView.frame.size.width)/2, scanView.frame.origin.y, scanView.frame.size.width, scanView.frame.size.height);
    
}

- (IBAction)close:(id)sender {
    if (_delegate && [_delegate respondsToSelector:@selector(closeButtonClicked)]) {
        [_delegate performSelector:@selector(closeButtonClicked) withObject:nil];
    }
}

@end
